(function () {
    Vue.component('Message', {
        data() {
            return {
                message:null,
                style: {
                    lineHeight:'40px',
                    height:'40px',
                    color: 'green',
                    backgroundColor:'gainsboro',
                    padding:'0px 15px'
                },
                isMe:false
            }
        },
        props: {
            'data' : Object,
        },
        template:`<div :style="style">{{ isMe ? '我' : data.from }}说： {{ data.content }}</div>`,
        mounted() {
            this.isMe = this.data.sessionId == this.data.from;
            this.style.color = this.isMe ? 'green' : 'white';
        }
    })
})();